package com.weyoung.app.controller;

import com.weyoung.app.dto.req.AddGraNodeDTO;
import com.weyoung.app.service.GraveVisitingNodeService;
import com.weyoung.common.consatant.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/grave")
@Tag(name = "APP端-墓地接口")
@Slf4j
@RequiredArgsConstructor
public class GraveController {

    private final GraveVisitingNodeService graveVisitingNodeService;

    @Operation(summary = "添加墓地节点")
    @PostMapping("/addGraveNode")
    public Result addGraveNode(@RequestPart("data") AddGraNodeDTO addGraNodeDTO,
                               @RequestPart(value = "file",required = false) MultipartFile file) {
        return graveVisitingNodeService.addGraveNode(addGraNodeDTO,file);
    }

    @Operation(summary = "查看墓地节点")
    @PostMapping("/getGraveNode/{id}")
    public Result getGraveNode(@PathVariable("id") Integer id ) {
        return graveVisitingNodeService.getGraveNode(id);
    }

    @Operation(summary = "家族墓地节点列表")
    @PostMapping("/getGraveNodeList")
    public Result getGraveNodeList() {
        return graveVisitingNodeService.getGraveNodeList();
    }

    @Operation(summary = "删除墓地节点")
    @PostMapping("/deleteGraveNode/{id}")
    public Result deleteGraveNode(@PathVariable("id") Integer id) {
        return graveVisitingNodeService.deleteGraveNode(id);
    }

}










